{extend name="ashippingguide/Public/base" /}
{block name="container"}
<div class="page-heade">
    <h2 class="title_color text-center">导购目标格式管理</h2>
</div>
<div class="col-md-12 mtp no-padding">
    <form action="{:url('addformatform')}" id="f1" class="form-inline" method="post">
        <table class="table table-bordered" style="width: 100%;font-size: 13px;">
            <tr>
                <td style="width: 30%;">是否设置网点维度 <span class="colorRed">*</span>:</td>
                <td style="width: 70%;"><label class="radio-inline"><input type="radio" value="1" name="wd_dimension" class="form-control" id="is_true">是</label><label class="radio-inline"><input type="radio" value="0" name="wd_dimension" class="form-control" checked id="is_no">否</label></td>
            </tr>
            <tr>
                <td style="width: 30%;">是否设置产品维度 <span class="colorRed">*</span>:</td>
                <td style="width: 70%;"><label class="radio-inline"><input type="radio" value="1" name="cp_dimension" class="form-control" id="isSetProduct">是</label><label class="radio-inline"><input type="radio" value="0" name="cp_dimension" checked class="form-control" id="noSetProduct">否</label></td>
            </tr>
            <script>
                $('#isSetProduct').click(function () {
                    $('#productTr').show();
                });
                $('#noSetProduct').click(function () {
                    $('#productTr').hide();
                });
            </script>
            <tr id="productTr" style="display: none">
                <td style="width: 30%;">产品维度 <span class="colorRed">*</span>:</td>
                <td style="width: 70%;">
                    <select id="cp_type" name="cp_type" class="form-control select validate[required]">
                        <option value="">请选择</option>
                        <option value="0">品牌</option>
                        <option value="1">品类</option>
                        <option value="2">系列</option>
                        <option value="3">SKU</option>
                        <option value="4">单品</option>
                    </select>
                </td>
            </tr>
            <tr id="cainianTr">
                <td style="width: 30%;">财年 <span class="colorRed">*</span>:</td>
                <td style="width: 70%;">
                    <select id="year" name="year" class="form-control select validate[required]">
                        <option value="2018">2018</option>
                        <option value="2019">2019</option>
                        <option value="2020">2020</option>
                        <option value="2021">2021</option>
                        <option value="2022">2022</option>
                        <option value="2023">2023</option>
                        <option value="2024">2024</option>
                        <option value="2025">2025</option>
                        <option value="2026">2026</option>
                        <option value="2027">2027</option>
                        <option value="2028">2028</option>
                        <option value="2029">2029</option>
                        <option value="2030">2030</option>
                        <option value="2031">2031</option>
                        <option value="2032">2032</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td style="width: 30%;">考核期维度 <span class="colorRed">*</span>:</td>
                <td style="width: 70%;">
                    <select id="kh_dimension" name="kh_dimension" class="form-control select validate[required]">
                        <option value="0">一级考核期</option>
                        <option value="1">二级考核期</option>
                    </select>
                </td>
            </tr>
        </table>
        <div class="text-center"><input type="button" value="保存" id="cp" class="btn btn-sm btn-primary"/><br/><br/><br/></div>
    </form>

</div>
<script>
    $('#f1').validationEngine('attach', {
        promptPosition: 'bottomRight'
    });
    $('#cp').click(function () {
        if($("#f1").validationEngine('validate')){
            $.ajax({
                'type':'post',
                'url':$("#f1").attr('action'),
                'data':$('#f1').serialize(),
                'dataType':'json',
                'success':function (data) {
                    if(data.success){
                            parent.location.reload();
                    }else
                        top.swal({
                            title: data.msg,
                            type: "warning"
                        });
                }
            });
            return false;
        }
    });
</script>
{/block}